import 'package:common_utils/common_utils.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:xinxuan/http/http_util_service.dart';

class FeedbackPageController extends GetxController {
  
  /// 联系人
  var contact = ''.obs;
  /// 反馈内容
  var content = ''.obs;

  /// 提交反馈
  submitFeedback() async {
    if (TextUtil.isEmpty(content.value)) {
      EasyLoading.showToast('请填写反馈信息');
      return;
    }
    if (TextUtil.isEmpty(contact.value)) {
      EasyLoading.showToast('请留下您的联系方式');
      return;
    }
    bool res = await HttpUtilService.submitFeedback(content: content.value, contact: contact.value);
    if (res) {
      contact.value = '';
      content.value = '';
      update();
      EasyLoading.showToast('反馈成功');
    }
  }

}